WIP: Route inline reasoning streams#3446
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration option, reasoning_stream_style, which allows users to customize how streaming reasoning content is handled and separated from the main answer text. It supports separate fields, inline tags (e.g., <think>...</think>), or treating reasoning content as standard text. The changes include updates to client initialization, SSE chunk parsing, configuration loading, documentation, and comprehensive unit tests. The reviewer suggested using fully qualified paths for SystemTime and UNIX_EPOCH in the new configuration test to avoid potential compilation issues if they are not imported.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let nanos = SystemTime::now() | ||
| .duration_since(UNIX_EPOCH) | ||
| .unwrap() | ||
| .as_nanos(); |
There was a problem hiding this comment.
To prevent potential compilation errors if SystemTime and UNIX_EPOCH are not imported in this test module, it is safer to use their fully qualified paths from std::time.
| let nanos = SystemTime::now() | |
| .duration_since(UNIX_EPOCH) | |
| .unwrap() | |
| .as_nanos(); | |
| let nanos = std::time::SystemTime::now() | |
| .duration_since(std::time::UNIX_EPOCH) | |
| .unwrap() | |
| .as_nanos(); |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
53ef812 to
3636629
Compare
|
Claude finished @Hmbown's task in 5m 19s —— View job PR Review: Route inline reasoning streams
SummaryThe routing logic is sound and the state machine for split-chunk tag parsing is correct. A few issues worth addressing before this ships, in priority order: 1. Silent fallback on unrecognized config value —
|
Add provider-scoped reasoning_stream_style handling for chat-completion streams so OpenAI-compatible routes can choose separate_field, inline_tags, or none without a new provider enum variant. Inline <think> blocks are streamed into Thinking content blocks, including tags split across SSE chunks, while none preserves raw visible text and existing separate-field reasoning keeps its default behavior. Refs #3222.
Limit the legacy parse_sse_chunk wrapper to test builds so release and clippy builds use only the style-aware stream parser path. Refs #3222.
Warn when reasoning_stream_style contains an unrecognized configured value, keep inline_tags mode from also consuming separate reasoning_content fields, and cover unclosed <think> stream flushes. Verified with: - cargo fmt --all -- --check - git diff --check - cargo test -p codewhale-tui --bin codewhale-tui --locked reasoning_style - cargo test -p codewhale-tui --bin codewhale-tui --locked provider_config_loads_reasoning_stream_style - cargo test -p codewhale-tui --bin codewhale-tui --locked stream_decoder_tests - cargo test -p codewhale-tui --bin codewhale-tui --locked qianfan_provider_accepts_custom_model_and_base_url - cargo clippy -p codewhale-tui --bin codewhale-tui --locked -- -D warnings -A clippy::uninlined_format_args -A clippy::too_many_arguments -A clippy::unnecessary_map_or -A clippy::assertions_on_constants
3636629 to
6900776
Compare
|
Claude finished @Hmbown's task in 2m 41s —— View job PR Review: Route inline reasoning streams (updated)
Follow-up on Previous FindingsThe two commits pushed since the initial review (
Fresh Review of Current StateThe implementation looks clean. A few observations on the final shape: State machine ( Match structure in
This correctly preserves the legacy behavior for unknown gateways while adding the two new explicit modes.
Config — Test coverage — 7 new tests cover: separate field routing, inline tag routing (including split across chunks), unclosed-tag flush, ignoring Minor notes (not blocking):
No new correctness issues found. This is ready to merge. |
Summary
reasoning_stream_styleconfig forseparate_field,inline_tags, andnonestream behavior<think>...</think>content into Thinking blocks, including tags split across SSE chunksTests
cargo fmt --all -- --checkcargo test -p codewhale-tui --bin codewhale-tui --locked reasoning_stylecargo test -p codewhale-tui --bin codewhale-tui --locked provider_config_loads_reasoning_stream_stylecargo test -p codewhale-tui --bin codewhale-tui --locked stream_decoder_testscargo test -p codewhale-tui --bin codewhale-tui --locked stream_reasoning(0 matching tests)git diff --checkRefs #3222.
Reported with detailed route-shape examples by @buko.